#include "stdlib.hpp"
#include <purewell/iopoll.hpp>

#include <map>

#include "iopollepoll.hpp"
#include "iopollselect.hpp"
#include "iopollpoll.hpp"

#ifdef WIN32
#	pragma warning(push)
#	pragma warning(disable: 4996)
#endif

namespace purewell
{

PWIOPoll*
PWIOPoll::create(const char* type)
{
	if ( !__PWSTRCMP_I(type, "select") ) return new PWIOPollSelect;
#if defined(__PW_HAVE_POLL)
	else if ( !__PWSTRCMP_I(type, "poll") ) return new PWIOPollPoll;
#endif//__PW_HAVE_POLL
#if defined(__PW_HAVE_EPOLL_CTL)
	else if ( !__PWSTRCMP_I(type, "epoll") ) return new PWIOPollEPoll;
#endif//__PW_HAVE_EPOLL_CTL
	return NULL;
}

void
PWIOPoll::release(PWIOPoll* io)
{
	delete io;
}

};// namespace purewell

#ifdef WIN32
#	pragma warning(pop)
#endif

